package com.market.service.impl;

import com.market.dto.GoodsDto;
import com.market.dto.GoodsTypeDto;
import com.market.entity.GoodsType;
import com.market.mapper.GoodsTypeMapper;
import com.market.service.GoodsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class GoodsTypeImpl implements GoodsTypeService {
    @Autowired
    private GoodsTypeMapper goodsTypeMapper;

    //新增商品类型
    @Override
    public boolean addGoodsType(String typeName) {
        goodsTypeMapper.addGoodsType(typeName);
        return true;
    }

    //通过商品id修改商品类型
    @Override
    public boolean updateGoodsTypeName(int typeId,String typeName) {
        goodsTypeMapper.updateGoodsTypeName(typeId,typeName);
        return true;
    }

    @Override
    public List<GoodsTypeDto> queryAllGoodsType() {
        List<GoodsTypeDto> goodsTypeDtos = goodsTypeMapper.queryAllGoodsType();

        return goodsTypeDtos;
    }

    @Override
    public List<GoodsType> queryTotalGoodsType() {
        return goodsTypeMapper.queryTotalGoodsType();
    }


}
